#! /usr/bin/python

from tweetslistener import tweetListener
import time, tweepy, sys, oauth

## authentication
consumerkey = oauth.CONSUMER_KEY ## put a valid Twitter username here
consumersecret = oauth.CONSUMER_SECRET
oauthkey = oauth.OAUTH_KEY
oauthsecret = oauth.OAUTH_SECRET

auth = tweepy.OAuthHandler(consumerkey, consumersecret)
auth.set_access_token(oauthkey, oauthsecret)
api = tweepy.API(auth)

def main():
    fileprefix = 'tweetstream'
    track = ['GTA V', 'GTA 5' 'Grand Theft Auto V']

    listen = tweetListener(api, fileprefix, 20000)
    stream = tweepy.streaming.Stream(auth, listen)

    print "Streaming started..."

    try:
        stream.filter(track = track)
    except:
        print "error!"
        stream.disconnect()

if __name__ == '__main__':
    main()